﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeGame.Networking.Clientside.ServerClientPackets
{
    class WorldResponcePacket : ClientPacket
    {
        public override ServerClientNet GetID()
        {
            return ServerClientNet.WorldResponce;
        }

        public override void Handle(Lidgren.Network.NetIncomingMessage message)
        {
            Console.WriteLine("Loading World1");
            if (Singletons.CurrentWorld != null)
            {
                Console.WriteLine("Loading World2");
                int count = message.ReadInt32();
                byte[] msg = message.ReadBytes(count);
                Singletons.CurrentWorld.LoadNetworkWorld(msg);
            }
        }
    }
}
